<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登陆--优客工厂</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
</head>
    <meta charset="UTF-8">
    <title>优客工厂</title>
</head>
<body>
手机号:<input type="text" class="phone">
<button class="login">登陆</button>

<script src="jquery-1.11.2.min.js"></script>
<script>
    $(document).on("click", ".login", function () {
        $.ajax({
            url: "http://localhost:8082/maps/login.do",
            type: "POST",
            datatype: "application/json",
            contentType: "application/json;charset=utf-8",
            data: JSON.stringify({
                loginName: $(".phone").val(),
                smsVerifyCode: "1122",
                verifyCode: "1122"
            }),
            success: function (result) {
                if (result.code == 0) {
                    alert("登陆成功");
                    sessionStorage.setItem("token",result.data.accessToken);
                    setTimeout(function () {
                        window.location.href = "preview.html";
                    }, 1000);
                } else {
                    alert("登陆失败，" + result.exception);
                }
            }
        })
    })
</script>
</body>
</html>